package com.example.shortbread;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;
import shortbread.Shortcut;

/**
 * MoviesAbility
 */
@Shortcut(id = "movies", action = "movie_shortcut", icon = ResourceTable.Media_ic_shortcut_movies,
        shortLabel = "movies", rank = 3, backStack = {MainAbility.class, BooksAbility.class},
        hostAbility = "com.example.shortbread.MainAbility")
public class MoviesAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_movies);
    }

    /**
     * addMovie（）注解生成对应的shortcut ,并且在点击对应的shortcut执行这个方法
     */
    @Shortcut(id = "add_movie", icon = ResourceTable.Media_ic_shortcut_add, shortLabel = "Add movie",
            hostAbility = "com.example.shortbread.MainAbility", rank = 4)
    public void addMovie() {
        ((Text) findComponentById(ResourceTable.Id_text)).setText("Add movie");
    }
}
